//
//  VMCImageLeftAlignmentButton.m
//  vmcshop
//
//  Created by bigknife on 14/11/12.
//  Copyright (c) 2014年 idongler. All rights reserved.
//

#import "VMCImageLeftAlignmentButton.h"

@implementation VMCImageLeftAlignmentButton

-(void)layoutSubviews {
	[super layoutSubviews];
	
	[self.imageView sizeToFit];
	CGRect imageRect = self.imageView.frame;
	
	
	[self.titleLabel sizeToFit];
	CGRect titleRect = self.titleLabel.frame;

	CGFloat totalWidth = CGRectGetWidth(self.imageView.frame) + CGRectGetWidth(self.titleLabel.frame) ;
	titleRect.origin.x = (CGRectGetWidth(self.frame) - totalWidth)/2;
	self.titleLabel.frame = titleRect;
	imageRect.origin.x = CGRectGetMaxX(titleRect) ;
	self.imageView.frame = imageRect;
}

@end
